home *** CD-ROM | disk | FTP | other *** search
/ Carousel / CAROUSEL.cdr / mactosh / util / simulare.sit / Simula 4.07 Reference / card_54305.txt < prev    next >
Text File  |  1989-05-02  |  2KB  |  84 lines

  1. -- card: 54305 from stack: in.07 Reference
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 13647
  5. -- name: 
  6.  
  7.  
  8. -- part 1 (field)
  9. -- low flags: 00
  10. -- high flags: 0000
  11. -- rect: left=272 top=144 right=162 bottom=407
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 0
  15. -- font id: 3
  16. -- text size: 10
  17. -- style flags: 0
  18. -- line height: 13
  19. -- part name: 
  20.  
  21.  
  22. -- part 2 (field)
  23. -- low flags: 00
  24. -- high flags: 0000
  25. -- rect: left=58 top=125 right=182 bottom=133
  26. -- title width / last selected line: 0
  27. -- icon id / first selected line: 0 / 0
  28. -- text alignment: 0
  29. -- font id: 3
  30. -- text size: 10
  31. -- style flags: 0
  32. -- line height: 13
  33. -- part name: 
  34.  
  35.  
  36. -- part 3 (button)
  37. -- low flags: 00
  38. -- high flags: A004
  39. -- rect: left=17 top=288 right=310 bottom=101
  40. -- title width / last selected line: 0
  41. -- icon id / first selected line: 0 / 0
  42. -- text alignment: 1
  43. -- font id: 0
  44. -- text size: 12
  45. -- style flags: 0
  46. -- line height: 16
  47. -- part name: Expressions
  48. ----- HyperTalk script -----
  49. on mouseUp
  50.   go to card id 53786
  51. end mouseUp
  52.  
  53.  
  54.  
  55.  
  56. -- part contents for background part 2
  57. ----- text -----
  58. Conditional expression
  59.  
  60. -- part contents for background part 1
  61. ----- text -----
  62.  
  63. A conditional expression is often convenient to use instead of an if-statement. Compare the following statement sequences;
  64.  
  65.   
  66.                                              can be written as
  67.  
  68.  
  69. The else-branch of a conditional expression may not be omitted. The types of the expressions in the then-branch and the else-branch must be compatible.
  70.  
  71. If a conditional expression is part of another expression, it must be enclosed in parentheses:
  72.  
  73.     a := 1 + (if x=y then 1 else 2);
  74.  
  75. -- part contents for card part 2
  76. ----- text -----
  77. if x=y then                            
  78.       a := 1 
  79.    else
  80.       a := 2
  81.  
  82. -- part contents for card part 1
  83. ----- text -----
  84. a := if x=y then 1 else 2;